package sky.wicket;

import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import sky.domain.Airport;
import sky.service.AirportService;
import sky.wicket.panels.AirportPanel;

/**
 * Created with IntelliJ IDEA.
 * User: Gauss
 * Date: 22.09.13
 * Time: 13:20
 * To change this template use File | Settings | File Templates.
 */
public class AirportInfo extends BasePage {

    @SpringBean
    AirportService airportService;

    public AirportInfo() {
    }

    public AirportInfo(PageParameters parameters) {
        addElementsToPage(parameters.get("airportName").toString());
    }

    private void addElementsToPage(String airportName) {
        add(new AirportPanel("panel", new Model<Airport>(airportService.getAirportByName(airportName)), false));
    }

}
